package com.f6.weixin.houtai.controller;

import java.io.IOException;
import java.io.InputStream;

import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.f6.utils.F6SystemUtils;
import com.f6.utils.SystemConstans;

@Controller
@RequestMapping(SystemConstans.HOUTAI + "/menu/")
public class MenuController {
	private Logger logger = LoggerFactory.getLogger(MenuController.class);

	@RequestMapping(value = "hi", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
	@ResponseBody
	public String hi() {
		return "hi 扑通扑通";
	}

	@RequestMapping(value = "create", method = RequestMethod.POST, produces = "application/json;charset=UTF-8")
	@ResponseBody
	public String create(@RequestParam String access_token) throws IOException {
		if (F6SystemUtils.isStrNull(access_token)) {
			return "";
		} else {
			InputStream in = this.getClass().getClassLoader().getResourceAsStream("menu.json");
			return IOUtils.toString(in);
		}
	}
}
